<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$account = query('account');
$result=get_user_info($account);
echo false===$result?'':json_encode($result);

function get_user_info($account) {
    if(!$account){
        return false;
    }
    $dsn = 'mysql:dbname=nodejs;host=106.15.49.79;port=3306;charset=utf8';
    $pdo = new PDO($dsn, 'root', 'xyx5659506bT!@#123');
    $stmt = $pdo->prepare('select userid, referral_qd from t_users where account=:account');
    $stmt->bindParam(':account', $account);
    $stmt->execute();
    while ($row = $stmt->fetch()) {
        return $row;
    }
    return false;
}

function query($name) {
    $value = isset($_REQUEST[$name]) ? $_REQUEST[$name] : '';
    if (!$value) {
        return $value;
    }
    $value = htmlentities($value);
    if (strlen($value) > 32) {
        $value = '';
    }
    return $value;
}
